package top.fengleifeng.question;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: leetcode-test
 * @description:
 * @author: fengleifeng
 * @create: 2020-10-12 14:41
 **/
public class Num85最大矩形 {

    class Solution {
        public int maximalRectangle(char[][] matrix) {
            //存储已经实现的
            Map<String, Integer> map = new HashMap<>();
            Integer max = 0;
            //循环数组 查找
            for (int i = 0; i < matrix.length; i++) {
                for (int j = 0; j < matrix[i].length; j++) {
                    if(matrix[i][j] == 1){
                        String s = getSize(matrix, i, j);
                        Integer integer = map.get(s);
                        if (null == integer) {
                            String[] sIn = s.split(",");
                            Integer intLeft1 = Integer.parseInt(sIn[0]);
                            Integer intLeft2 = Integer.parseInt(sIn[1]);
                            Integer intright1 = Integer.parseInt(sIn[2]);
                            Integer intright2 = Integer.parseInt(sIn[3]);
                            Integer size = (intright1 - intLeft1) * (intright2 - intLeft2);
                            max = Math.max(max,size);
                            map.put(s,size);
                        }
                    }
                }
            }
            //查找最大的int
            return max;
        }

        private String getSize(char[][] matrix, int i, int j) {
            return "";
        }
    }
}
